<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>邮件发送</title>
</head>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<body>
<form>
    <h1>邮箱登录</h1>
    用户名:<input type="text" name="username"><br>
    邮&nbsp;&nbsp;&nbsp;&nbsp;箱:<input type="text" name="email">
    <div style="display: flex">
        验证码:<input type="text" name="code" width="80%">
        <input type="button" name="username" width="20%" value="发送">
    </div>
    <input type="submit" name="sub" value="登录">
</form>
</body>
<script>
    function send(){
        var username = $("input[name='username']").val();
        var email = $("input[name='email']").val();
        if(username.length<=0||email.length<=0||isEmail(email)){
            alert("姓名和邮箱不能为空！");
        }else{
            $.post('../sy4/sendEmail.do',{
                'username':username,
                'email':email
            },function (res){

            })
        }
    }

    function isEmail(){
        return false;
    }
</script>
</html>